﻿using System;
using System.Threading;
using System.Windows.Forms;
using DCS.CalculationClient;
using DCS.CalculationClient.View;

namespace DCS.CaclulationClient
{
    public static class Program
    {
        /// <summary>
        /// Главная точка входа для приложения.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var model = new Model();
            var form = new MainForm(model);
            model.SetView(form);
            
            Application.Run(form);
        }

        public static void ShowForm(Form form)
        {
            var t = new Thread(RunForm){IsBackground = true};
            t.SetApartmentState(ApartmentState.STA);
            t.Start(form);
        }

        private static void RunForm(object form)
        {
            Application.Run(form as Form);
        }
    }
}
